/**
 * Created by cjd on 2016/6/12.
 */
angular.module("app").controller("group.volunteerList.Ctrl", ["$scope", "group","$stateParams", function ($scope, group,$stateParams) {
    $scope.volunteerGridConfig = {
        bindingOptions: {
            selectedRowKeys: "selectedItems",
            dataSource: "volunteerGridConfig.dataSource"
        },
        twoWayBindingEnabled: false,
        searchPanel: {
            visible: true,
            width: 200,
            placeholder: "输入关键字进行查询"
        },
        paging: {
            pageSize: 15
        },
        groupPanel: {
            visible: true,
            emptyPanelText: "拖动列名进行分组和排序"
        },
        hoverStateEnabled: true,
        showBorders: true,
        showRowLines: true,
        rowAlternationEnabled: true,
        noDataText: "没有数据",
        columns: [{
            dataField: "realName",
            alignment: "center",
            caption: "姓名"
        }, {
            dataField: "mobile",
            alignment: "center",
            caption: "手机号"
        }, {
            dataField: "acts",
            alignment: "center",
            width:80,
            caption: "活动次数"
        }, {
            dataField: "times",
            alignment: "center",
            width:80,
            caption: "公益时间"
        }, {
            dataField: "operation",
            alignment: "center",
            cellTemplate: "operationCellTemplate",
            caption: "操作"
        }]
    };
    $scope.getList = function (groupId) {
        group.volListById({}, {id: groupId}, function (data) {
            if (data.statusCode == 0) {
                $scope.volunteerGridConfig.dataSource = data.data;
            }
        });
    };

    $scope.showActivityList = function (volunteerInfo) {
        location.href = "#/home/group/activityList/" + volunteerInfo.id;
    };
    $scope.getList($stateParams.groupId);
}]);